package com.homework.loans;

import io.dropwizard.lifecycle.Managed;
import org.h2.tools.Server;

/**
 * Starts/stops H2 in memory DB.
 *
 * @author Blind
 */
public class DatabaseComponent implements Managed {
    private Server server;

    public void start() throws Exception {
        server = Server.createWebServer().start();
    }

    public void stop() throws Exception {
        if (server != null) {
            server.stop();
        }
    }
}
